import axios from 'axios'
import { Indicator } from 'mint-ui';


export default {
  common: {
    method: "GET",
  },
  $axios(options = {}) {
    options.method = options.method || "GET"

    //请求前==>加载Indicator
    Indicator.open('加载中...');

    return new Promise((suc, rej) => {
      axios(options).then(req => {
        //结束==》关闭Indicator
        setTimeout(() => {
          Indicator.close();
        }, 500)
        suc(req)
      }).catch(err => {
        rej(err)
      })
    })
  }
}